<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<link href="__STATIC__/css/admin/style.css" rel="stylesheet"/>
	<title><?php echo L('website_manage');?></title>
	<script>
	var URL = '__URL__';
	var SELF = '__SELF__';
	var ROOT_PATH = '__ROOT__';
	var APP	 =	 '__APP__';
	//语言项目
	var lang = new Object();
	<?php $_result=L('js_lang');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?>lang.<?php echo ($key); ?> = "<?php echo ($val); ?>";<?php endforeach; endif; else: echo "" ;endif; ?>
	</script>
</head>

<body>
<div id="J_ajax_loading" class="ajax_loading"><?php echo L('ajax_loading');?></div>
<?php if(($sub_menu != '') OR ($big_menu != '') OR ($ajaxMenuList != '')): ?><div class="subnav">
    <div class="content_menu ib_a blue line_x">
    	<?php if(!empty($big_menu)): ?><a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo ($big_menu["iframe"]); ?>" data-title="<?php echo ($big_menu["title"]); ?>" data-id="<?php echo ($big_menu["id"]); ?>" data-width="<?php echo ($big_menu["width"]); ?>" data-height="<?php echo ($big_menu["height"]); ?>"><em><?php echo ($big_menu["title"]); ?></em></a>　<?php endif; ?>

        <?php if(!empty($ajaxMenuList)): if(is_array($ajaxMenuList)): foreach($ajaxMenuList as $key=>$big_menu): ?><a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo ($big_menu["iframe"]); ?>" data-title="<?php echo ($big_menu["title"]); ?>" data-id="<?php echo ($big_menu["id"]); ?>" data-width="<?php echo ($big_menu["width"]); ?>" data-height="<?php echo ($big_menu["height"]); ?>"><em><?php echo ($big_menu["title"]); ?></em></a>　<?php endforeach; endif; endif; ?>      
        <?php if(!empty($sub_menu)): if(is_array($sub_menu)): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($key % 2 );++$key; if($key != 1): ?><span>|</span><?php endif; ?>
        <a href="<?php echo U($val['moduleName'].'/'.$val['actionName'],array('menuid'=>$menuid)); echo ($val["data"]); ?>" class="<?php echo ($val["class"]); ?>"><em><?php echo L($val['name']);?></em></a><?php endforeach; endif; else: echo "" ;endif; endif; ?>
    </div>
</div><?php endif; ?>
<!--添加管理员-->
<div class="pad_lr_10">
	<div class="col_tab">
		<ul class="J_tabs tab_but cu_li">
			<li class="current"><?php echo L('admin_add');?></li>			
		</ul>
     <div class="content_list pad_10">   
	<form id="info_form" name="info_form" action="<?php echo u('admin/add');?>" method="post">
	<table width="100%" class="table_form">
		<tr> 
	      <th width="80"><?php echo L('admin_userName');?> :</th>
	      <td><input type="text" name="userName" id="J_userName" class="input-text"></td>
	    </tr>
	    <tr> 
	      <th><?php echo L('passWord');?> :</th>
	      <td><input type="text" name="passWord" id="J_password" value="1234567" class="input-text"></td>
	    </tr>
        
	    <tr>
	      <th><?php echo L('cofirmpwd');?> :</th>
	      <td><input type="text" name="repassWord" id="J_repassWord" value="1234567" class="input-text"></td>
	    </tr>
        
	    <tr>
	    	<th><?php echo L('real_name');?> :</th>
	    	<td><input type="text" name="realName" class="input-text" size="30"></td>
	    </tr>
	    <tr>
	    	<th><?php echo L('user_phone');?> :</th>
	    	<td><input type="text" name="phone" class="input-text" size="30"></td>
	    </tr>        
	    <tr>
	    	<th><?php echo L('admin_email');?> :</th>
	    	<td><input type="text" name="email" class="input-text" size="30"></td>
	    </tr>        
        
	    <tr>
	    	<th><?php echo L('user_company');?> :</th>
	    	<td><input type="text" name="company" class="input-text" size="30"></td>
	    </tr>        
 	    <tr>
	    	<th><?php echo L('user_job_post');?> :</th>
	    	<td><input type="text" name="jobPost" class="input-text" size="30"></td>
	    </tr>        
 	    <!--tr>
	    	<th>SIM :</th>
	    	<td><input type="text"  id="sim_con" name="sim" class="input-text readonly" readonly="true" size="30">
                <a href="javascript:void(0);" id="select_sim" ><b><?php echo L('please_select');?> sim</b></a>
            </td>
	    </tr>
        <tr id="iframe_sim">
            <td colspan="2">
                <iframe src="<?php echo U('padSim/index',array('type'=>'ajax'));?>" width="100%" style="border: none; height: 300px;; "></iframe>
            </td>
        </tr>                                 
 	    <tr>
	    	<th><?php echo L('user_have_imei');?> :</th>
	    	<td><input type="text" id="imei_con" name="imei" class="input-text readonly" readonly="true" size="30">
                <a href="javascript:void();" id="select_imei"><b><?php echo L('please_select');?> imei</b></a>
            </td>
	    </tr>
        <tr id="iframe_imei">
            <td colspan="2">
                <iframe src="<?php echo U('padImei/index',array('type'=>'ajax'));?>" width="100%" style="border: none; height: 300px;; "></iframe>
            </td>
        </tr-->         

	    <tr>
	      <th><?php echo L('admininrole');?> :</th>
	      <td>
	      	<select name="roleId" id="roleId">
                <option value=""><?php echo L('please_select');?></option>
	        	<?php if(is_array($role_list)): $i = 0; $__LIST__ = $role_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><option value="<?php echo ($val["id"]); ?>" level_id="<?php echo ($val["regionLevel"]); ?>" select_customer="<?php echo ($val["selectCustomer"]); ?>"><?php echo ($val["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
	        </select>
            
	      </td>
	    </tr>
 	    <tr>
	      <th><?php echo L('select_region');?> :</th>
	      <td>
                    <select class="J_cate_select mr10" data-pid="0" data-uri="<?php echo U('region/ajax_getchilds');?>" data-selected=""></select>
                    <input type="hidden" name="regionId" id="J_cate_id" value="<?php echo ($search["cate_id"]); ?>" />            
	      </td>
	    </tr>
         
        <!--tr id="customerIds" style="display: none;">
            <th>选择客户 :</th>
            <td>
                <?php if(is_array($customerList)): $i = 0; $__LIST__ = $customerList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i;?><label><input type="checkbox" name="customerIds[]" value="<?php echo ($key); ?>" /><?php echo ($item); ?></label>&nbsp;&nbsp;<?php endforeach; endif; else: echo "" ;endif; ?>
            </td>
        </tr-->      
	</table>

    </div>
    </div>
    <div class="mt10"><input type="submit" value="<?php echo L('submit');?>" id="dosubmit" name="dosubmit" class="btn btn_submit" style="margin:0 0 10px 100px;"><br /><br /><br /></div>
</div>
	</form>
<script src="__STATIC__/js/jquery/jquery.js"></script>
<script src="__STATIC__/js/jquery/plugins/jquery.tools.min.js"></script>
<script src="__STATIC__/js/jquery/plugins/formvalidator.js"></script>
<script src="__STATIC__/js/pinphp.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script>
//初始化弹窗
(function (d) {
    d['okValue'] = lang.dialog_ok;
    d['cancelValue'] = lang.dialog_cancel;
    d['title'] = lang.dialog_title;
})($.dialog.defaults);
</script>

<?php if(isset($list_table)): ?><script src="__STATIC__/js/jquery/plugins/listTable.js"></script>
<script>
$(function(){
	$('.J_tablelist').listTable();
});
</script><?php endif; ?>
<script>
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});
    	
	$("#J_userName").formValidator({ onshow:lang.please_input+lang.admin_username, onfocus:lang.please_input+lang.admin_username}).inputValidator({ min:1, onerror:lang.please_input+lang.admin_username}).ajaxValidator({type:"get", url:"", data:"m=admin&g=admin&a=ajax_check_name", datatype:"html", async:'false', success:function(data){ if(data == "1"){return true;}else{return false;}}, onerror:lang.admin_name_exists, onwait:lang.connecting_please_wait});
    
	$("#J_password").formValidator({ onshow:lang.please_input+lang.password+lang.default_password, onfocus:lang.password+lang.between_6_to_20}).inputValidator({min:6, max:20, onerror:lang.password+lang.between_6_to_20, oncorrect:"d"});
    
	$("#J_repassWord").formValidator({ onshow:lang.cofirmpwd, onfocus:lang.cofirmpwd}).compareValidator({desid:"J_password",operateor:"=",onerror:lang.passwords_not_match});


});    
    
    $("#roleId").change(function(){       
        var _this = $(this);
        var role_id = _this.val();        
        var option=$("option:selected",_this);
        var level_id = option.attr("level_id");
        var select_customer = option.attr("select_customer");
        level_id = Number(level_id);
        if(role_id){
            var data_uri = "/index.php?g=admin&m=region&a=ajax_getchilds&max_level="+level_id;
            if(level_id>2){
                data_uri +="&type=store";
            }
            $(".J_cate_select").attr("data-uri",data_uri);
            $('.J_cate_select').empty();
            $('.J_cate_select').cate_select();
            
            // 需要选择客户
            if(select_customer==1){
                $("#customerIds").show();
            }else{
                $("input[name='customerIds[]']").each(function(){
                   $(this).attr("checked",false);
                });              
                $("#customerIds").hide();
            }
        }       
    });


    //imei 和 sim 层的显示与隐藏
    var speed = 1500;
    $("#iframe_sim").hide();
    $("#iframe_imei").hide();
    $("#select_sim").click(function(){
       $("#iframe_sim").show(speed); 
    });    
    $("#imei_con").focus(function(){
        $("#iframe_imei").show(speed); 
    });   
    $("#sim_con").focus(function(){
        $("#iframe_sim").show(speed); 
    });    
    $("#select_imei").click(function(){
       $("#iframe_imei").show(speed); 
    });   
    $("#sim_con").focusout(function(){     
        $("#iframe_sim").hide(speed);
    });
    $("#imei_con").focusout(function(){     
        $("#iframe_imei").hide(speed);
    });    
    function select_imei_click(v){
         $("#imei_con").val(v);
         $("#iframe_imei").hide(speed);
    }
    function select_sim_click(v){
         $("#sim_con").val(v);
         $("#iframe_sim").hide(speed);
    }
</script>
</body>
</html>